<div class="page-title">
	Prefix administration &mdash;&gt; add prefix
</div>

<div class="options-group" id="prefix-alloc-method_container" ng-show="prefix_alloc_method_provided == false">
	<div class="options-content">
		<h3 class="options-group-heading">Prefix allocation method</h3>

		<div class="option">
			<dl>
				<dt style="text-align: left;">
				<input id="radio-from-pool" type="radio" name="prefix_alloc_method" value="from-pool" ng-model="prefix_alloc_method">
				<label for="radio-from-pool">From pool</label>
				</dt>
				<dd>
				Get a prefix from a pre-defined prefix pool.
				</dd>
			</dl>
		</div>

		<div class="rule"></div>

		<div class="option">
			<dl>
				<dt style="text-align: left;">
				<input id="radio-from-prefix" type="radio" name="prefix_alloc_method" value="from-prefix" ng-model="prefix_alloc_method">
				<label for="radio-from-prefix">From prefix</label>
				</dt>
				<dd>
				Get a prefix allocated from another prefix.
				</dd>
			</dl>
		</div>

		<div class="rule"></div>

		<div class="option">
			<dl>
				<dt style="text-align: left;">
				<input id="radio-manual" type="radio" name="prefix_alloc_method" value="manual" ng-model="prefix_alloc_method">
				<label for="radio-manual">Manual</label>
				</dt>
				<dd>
				Specify all data manually
				</dd>
			</dl>
		</div>

	</div>
</div>

<!--

FROM-POOL

-->
<div id="from-pool_container" ng-show="prefix_alloc_method == 'from-pool'">
	<div class="options-group">
		<div class="options-content">
			<h3 class="options-group-heading">Pool allocation options</h3>


			<div class="option">
				<dl>
					<dt style="text-align: left;">
					Family
					</dt>
					<dd>
					<input type="radio" name="prefix_family" value="4" id="family_4_radio" ng-model="prefix_family">
					<label for="family_4_radio">IPv4</label>
					<input type="radio" name="prefix_family" value="6" id="family_6_radio" ng-model="prefix_family">
					<label for="family_6_radio">IPv6</label>
					</dd>
				</dl>
			</div>

			<div class="rule"></div>

			<div style="padding: 20px;" nipap-pool-selector selected-pool="from_pool" ng-show="from_pool_provided == false"></div>

			<div class="rule"></div>

			<div class="option" ng-show="from_pool !== null">
				<dl>
					<dt style="text-align: left;">
						Allocating from pool
					</dt>
					<dd id="selected_pool_desc">
						{{ from_pool.name }} &mdash; {{ from_pool.description }}
					</dd>
					<dt style="text-align: left;" id="length_edit_row">
						Prefix-length
					</dt>
					<dd id="length_edit_row">
						<input type="radio" id="edit_length_default_radio" name="edit_length" ng-model="pool_use_default_preflen" ng-value="true" ng-disabled="!pool_has_default_preflen">
						<label for="edit_length_default_radio">Use pools default prefix-length of /{{ pool_default_preflen }}</label>
						<br/>
						<input type="radio" id="edit_length_override_radio" name="edit_length" ng-model="pool_use_default_preflen" ng-value="false">
						<label for="edit_length_override_radio">Override pools default prefix-length</label>
						<br/>
						<div id="length_row" ng-show="pool_use_default_preflen == false">
							Use prefix-length:
							<span class="required" uib-tooltip="Pool is missing default prefix length for IPv{{ prefix_family }}, thus is this field required." ng-show="pool_has_default_preflen !== true">*&nbsp;</span>
							<input type="text" size=3 name="prefix_length_pool" ng-model="prefix_length">
						</div>
					</dd>
				</dl>
			</div>

		</div>
	</div>
</div>

<!--

FROM-PREFIX

-->
<div id="from-prefix_container" ng-show="prefix_alloc_method == 'from-prefix'">
	<div class="options-group">
		<div class="options-content">
			<h3 class="options-group-heading">Prefix allocation options</h3>
			<div class="option" ng-show="from_prefix !== null">
				<dl>
					<dt>
						Allocating from parent prefix
					</dt>
					<dd>
						{{ from_prefix.display_prefix }} - {{ from_prefix.description }}
					</dd>
					<dt>
						Prefix-length of new prefix
					</dt>
					<dd>
						<input type="text" name="prefix_length_prefix" ng-show="from_prefix.type != 'assignment'" ng-model="prefix_length">
                        <span uib-tooltip="The parent prefix is of type assignment, prefix-length of the new prefix will thus be /{{ prefix_length }}." ng-show="from_prefix.type == 'assignment'">/{{ prefix_length }}</span>
					</dd>
				</dl>
			</div>
		</div>
	</div>
</div>

<ng-include src="'/static/templates/prefix_form.html'"></ng-include>

<div id="prefix_added_container" ng-show="added_prefixes.length > 0">
	<div class="options-group">
		<div class="options-content">
			<h3 class="options-group-heading">Result</h3>
			<div id="prefix_added_list" ng-repeat="prefix in added_prefixes | orderBy:'id':true">
				<div class="prefix_added_entry">Added prefix: {{ prefix.prefix }} - {{ prefix.description }}</div>
			</div>
		</div>
	</div>
</div>
